import React from 'react'
import './App.css'
import { HashRouter as Router, NavLink, Route, Redirect } from 'react-router-dom'
import routers from './router'

class App extends React.Component {

  render() {
    return (
      <div className="app">
        <Router>
          <div className="nav">
            {
              routers.map((item, index) => {
                return (
                  <NavLink className="nav-item" activeClassName="active" to={ item.path }  key={ index }>{ item.name }</NavLink>
                )
              })
            }
          </div>
          <div className="main">
            {/* <Route path="/*" exact component={ Layout }></Route> */}
            {
              routers.map((item, index) => {
                return (
                  <Route path={ item.path } exact={ item.exact } component={ item.component } key={ index }></Route>
                )
              })
            }
            <Redirect to="/layout" />
          </div>
        </Router>
      </div>
    )
  }

}

export default App